$(function(){
	//表单渲染
	$('#form1').submit(function() {
		var options = {
			url : ctp + "/projectController/projectSave.shtml",
			type : 'POST',
			success : function(result) {
				if(result=='1') {  
					jalert9("保存成功！");
					setTimeout(function(){
						parent.searchData();
						back();
					},WARN_TIME_OUT);
				}else if(result=='0') {     
					jalert("保存失败，请联系管理员！");   
				} else if(result=='2'){
					jalert("项目名称已存在，请更换！");
				}
			}
		};
		$('#form1').ajaxSubmit(options);
		return false;
	});
});
function uploadFile(){
	//alert(document.getElementById("contract").files[0].name);
	//alert(document.getElementById("contract").files[1].name);
	//alert(document.getElementById("contract").files[2].name);
	var files=document.getElementById("contract").files;
	var fileStr="";
	for(var i=0;i<files.length;i++){
		fileStr+=files[i].name+',';
	}
	$('#file-name').html(fileStr);
}

function projectAdd() {
	setTagAndValue("form1","areaLName",$('#areaCode').val());
	setTagAndValue("form1","areaCode",$('#areaCode').attr("data-code"));
	//alert($('#areaCode').attr("data-code"));
	if (!Validator.Validate(document.getElementById("form1"), 1)) {
		return;
	}
	
	$('#form1').submit();
}

function back(){
	window.parent.closeDialogWin();
}
